﻿#pragma once
#include "AsGraphicsObject.h"

__AS_JY(Update 2023.1.7)
namespace AsGraphicsNamespace {

	AS_MEMBER_CLASS_DECLARATION(AsGraphicsRectCreator);

	class AS_GRAPHICS_API AsGraphicsRectCreator : public AsGraphicsObject, public AsBinder<AsGraphicsRectCreator> {
		Q_OBJECT

	public:
		explicit AsGraphicsRectCreator(QObject* parent = nullptr);
		explicit AsGraphicsRectCreator(AsGraphics* graphics, QObject* parent = nullptr);
		~AsGraphicsRectCreator();

	private:
		AS_MEMBER_CLASS(AsGraphicsRectCreator)* mp;

	public:
		void create(AsGraphics* graphics, QObject* parent = nullptr);
		void destroy();

	public:
		QRect getRectInWidget();
		QRectF getRect();

	public:
		void setRectStyle(const QPen& pen, const QBrush& brush);
		void setTriggerMouseButton(Qt::MouseButton button = Qt::MouseButton::LeftButton);
		void setTriggerKeyButton(Qt::Key button = (Qt::Key)0);

	signals:
		void sigRectCommitted(QRectF rect);
		void sigRectChanged(QRectF rect);

	};

	typedef AsGraphicsRectCreator RectCreator;

};

namespace AG = AsGraphicsNamespace;

